<template>
	<view :class="isDark ? 'dark' : ''" :style="{'background-color':isDark?'#1c1c1c':'#f6f6f6','min-height':isDark?'100vh':'auto'}">
		<home v-show="curType=='home'" :curPage="0" v-if="tabCurTab==isLogin" :isDark="isDark"></home>
		<find v-show="curType=='find'" :curPage="1" v-if="tabCurTab==isLogin" :isDark="isDark"></find>
		<msg v-show="curType=='msg'" :curPage="2" v-if="tabCurTab==isLogin" :isDark="isDark"></msg>
		<user v-show="curType=='user'" :curPage="3" v-if="tabCurTab==isLogin" :isDark="isDark"></user>
		<!-- 全屏发布弹窗 -->
		<view class="publish-modal" :class="isPost ? 'show' : ''" v-if="tabCurTab==isLogin" @tap="getShow()">
			<!-- 弹窗内容 -->
			<view class="publish-modal-content" :class="isPost ? 'show' : ''" @tap.stop="">
				<!-- 顶部文案区域 -->
				<view class="publish-header">
					<view class="publish-title">{{$t('home.index.recentnotice')}}</view>
					<view class="publish-subtitle" v-html="announcement"></view>
				</view>
				
				<!-- 发布选项区域 -->
				<view class="publish-options">
					<view class="publish-grid">
						<view class="publish-item" v-if="sy_appbox&&appModOrder==1" @tap="toLink('../plugins/sy_appbox/post')">
							<view class="publish-icon-container app-icon">
								<view class="tn-icon-folder"></view>
							</view>
							<text class="publish-text">{{$t('home.index.applicationsubmit')}}</text>
						</view>
						
						<view class="publish-item" v-if="wzof==1&&modOrder==2" @tap="toLink('../edit/articlePost')">
							<view class="publish-icon-container article-icon">
								<view class="tn-icon-image-text"></view>
							</view>
							<text class="publish-text">{{$t('home.index.articlesubmit')}}</text>
						</view>
						
						<view class="publish-item" v-if="tzof==1" @tap="toLink('../forum/section?type=2')">
							<view class="publish-icon-container forum-icon">
								<view class="tn-icon-calendar"></view>
							</view>
							<text class="publish-text">{{$t('global.publishpost')}}</text>
						</view>
						
						<view class="publish-item" v-if="wzof==1&&modOrder==1" @tap="toLink('../edit/articlePost')">
							<view class="publish-icon-container article-icon">
								<view class="tn-icon-image-text"></view>
							</view>
							<text class="publish-text">{{$t('home.index.articlesubmit')}}</text>
						</view>
						
						<view class="publish-item" v-if="sy_appbox&&appModOrder==0" @tap="toLink('../plugins/sy_appbox/post')">
							<view class="publish-icon-container app-icon">
								<view class="tn-icon-folder"></view>
							</view>
							<text class="publish-text">{{$t('home.index.applicationsubmit')}}</text>
						</view>
						
							<view class="publish-item" @tap="toLink('../space/post?type=0')">
								<view class="publish-icon-container dynamic-icon">
									<view class="tn-icon-topics"></view>
								</view>
								<text class="publish-text">{{$t('home.index.textdynamic')}}</text>
							</view>
							
							<view class="publish-item" @tap="toLink('../space/post?type=4')">
								<view class="publish-icon-container video-icon">
									<view class="tn-icon-live-stream"></view>
								</view>
								<text class="publish-text">{{$t('global.videoupdate')}}</text>
							</view>
						
						<!--  #ifdef H5 || APP-PLUS -->
						<view class="publish-item" v-if="shopof==1" @tap="toLink('../edit/addshop')">
							<view class="publish-icon-container shop-icon">
								<view class="tn-icon-cart"></view>
							</view>
							<text class="publish-text">{{$t('global.publishproduct')}}</text>
						</view>
						<!--  #endif -->
					</view>
				</view>
				
				<!-- 关闭按钮 - 放在原始加号位置 -->
				<view class="publish-close-center" @tap="getShow()">
					<view class="close-icon-center"><text class="cuIcon-close"></text></view>
				</view>
			</view>
		</view>

		<view class="tabbar" :style="{'padding-bottom': paddingBottomHeight + 'upx'}" :class="$store.state.AppStyle" v-if="tabCurTab==isLogin">
			<block v-for="(item, index) in list" :key="index" v-if="tabCurTab==isLogin">

				<view class="tabbar-item" @tap="tabbarChange(item.type,index)">
					<view class="user-rz">
						<image class="item-img" :src="getTabIcon(item, true)" v-if="curType == item.type"></image>
						<image class="item-img" :src="getTabIcon(item, false)" v-else></image>
						
						<!-- #ifdef  H5 -->
						<view class="cu-tag round bg-red sm user-rz-icon border-white" v-if="index == 2&&msgNoticeSum!=0&&msgNoticeSum<=99">{{msgNoticeSum}}</view>
						<view class="cu-tag round bg-red sm user-rz-icon border-white" v-if="index == 2&&msgNoticeSum>99">99+</view>
						<!-- #endif -->
						<!-- #ifdef APP-PLUS || MP -->
						<view class="cu-tag round bg-red sm user-rz-icon-xcx border-white" v-if="index == 2&&msgNoticeSum!=0&&msgNoticeSum<=99">{{msgNoticeSum}}</view>
						<view class="cu-tag round bg-red sm user-rz-icon-xcx border-white" v-if="index == 2&&msgNoticeSum>99">99+</view>
						<!-- #endif -->
					</view>
					<view class="item-name" :class="{'tabbarActive': curType == item.type}" v-if="item.text">
						{{item.text}}</view>
					<!-- <image class="item-img" :src="item.icon_a+curStyle+'.png'" v-if="curType == item.type"></image>
					<view class="item-name" :class="{'tabbarActive': curType == item.type}" v-if="item.text">{{item.text}}</view> -->
				</view>
				<view class="tabbar-item addPost" v-if="index==1" @tap="getShow()" :class="isPost?'postShow':''">
					<view class="addPost-main">
						<view class="addPost-i">
							<view class="addPost-move">
								<text class="cuIcon-add"></text>
							</view>
						</view>
					</view>
				</view>
			</block>
		</view>
		<!--维护弹窗-->
		<view class="announcement" v-if="tabCurTab==0">
			<view class="announcement-bg">
		
			</view>
			<view class="announcement-main">
				<view class="announcement-title">
					{{$t('home.index.connectionfail')}}
				</view>
				<view class="announcement-concent" style="background-color: white;">
					<rich-text :nodes="whtext"></rich-text>
				</view>
				<view class="announcement-btn tn-flex" style="justify-content: space-around;">
					<button class="cu-btn bg-blue lg" @tap="getgg()">{{$t('home.index.refresh')}}</button>
					<button class="cu-btn bg-blue lg" @tap="gogw">{{$t('home.index.offwebsite')}}</button>
					<button class="cu-btn bg-blue lg" @tap="goqun">{{$t('home.index.addgroup')}}</button>
				</view>
			</view>
		</view>
		<!--弹窗公告-->
		<view class="announcement" v-if="isAnnouncement&&Update!=1&&tabCurTab==isLogin">
			<view class="announcement-bg" @tap="isAnnouncement=false">
		
			</view>
			<view class="announcement-main">
				<view class="announcement-title">
					{{$t('home.index.notice')}}
					<text class="cuIcon-close text-red" @tap="isAnnouncement=false"></text>
				</view>
				<view class="announcement-concent" style="background-color: white;">
					<rich-text :nodes="announcement"></rich-text>
				</view>
				<view class="announcement-btn">
					<button class="cu-btn bg-blue lg" @tap="readAnnouncement">{{$t('home.index.myknow')}}</button>
				</view>
			</view>
		</view>
		<!--update-->
		<!--  #ifdef H5 || APP-PLUS -->
		<view v-if="iosOf!=0&&scrollTop>40" class="forum-post-btn-2 tn-main-gradient-orange box-shadow-2" @tap="refresh()">
					<text class="tn-icon-refresh-simple"></text>
				</view>
				<view v-if="iosOf!=0&&scrollTop<=40" class="forum-post-btn-1 tn-main-gradient-orange box-shadow-2" @tap="refresh()">
					<text class="tn-icon-refresh-simple"></text>
				</view>
				<view v-if="scrollTop>40" class="forum-post-btn-1 tn-main-gradient-blue box-shadow-1" @tap="totop()">
					<text class="tn-icon-totop"></text>
				</view>
			<!--  #endif -->
		<!--  #ifdef APP-PLUS -->
		<view class="update" v-if="Update==1&&tabCurTab==isLogin">
			<view class="update-bg">

			</view>
			<view class="update-box">
				<view class="update-main">
					<image src="../../static/app-plus/ic_ar.png"></image>
					<view class="update-title">{{$t('home.index.findnewversion')}}</view>
					<view class="update-intro"><rich-text :nodes="versionIntro"></rich-text>{{$t('home.index.newversionnumber')}}:{{versionTitle}}</view>
					<view class="update-btn grid col-1" v-if="qzgx==1">
						<view class="update-btn-box">
							<view class="update-btn-main bg-blue" @tap="isUpdate(true)">
								{{$t('home.index.updatenow')}}
							</view>
						</view>
					</view>
					<view class="update-btn grid col-2" v-else>
						<view class="update-btn-box">
							<view class="update-btn-main bg-blue" @tap="isUpdate(true)">
								{{$t('home.index.update')}}
							</view>
						</view>
						<view class="update-btn-box">
							<view class="update-btn-main bg-gray" @tap="closeUpdate()">
								{{$t('common.cancel')}}
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!--  #endif -->
		<!--#ifdef APP-PLUS-->
		<view class="Startupmap" v-if="!isStart&&isvip==0">
			<view class="Startupmap-close" @tap="toStart">
				<text>{{$t('home.index.skip')}}</text>
			</view>
			<view class="Startupmap-pic" @tap="toStartUrl">
				<image :src="startImg.localUrl"></image>
			</view>
		</view>
		<!--#endif-->
	</view>

</template>

<script>
	import darkModeMixin from '@/utils/darkModeMixin.js';	
	import {
		localStorage
	} from '../../js_sdk/mp-storage/mp-storage/index.js'
	
		
	export default {
		mixins: [darkModeMixin],
		data() {
			return {
				isPost: false,
				// #ifdef APP-PLUS || H5
				paddingBottomHeight: 0, //苹果X以上手机底部适配高度
				// #endif
				list: [{
					text: $t('home.index.homepage'),
					icon: '/static/tabbar/home.png', //未选中图标
					icon_a: '/static/tabbar/home_cur', //选中图片
					type: "home",
				}, {
					text: $t('home.index.find'),
					icon: '/static/tabbar/square.png',
					icon_a: '/static/tabbar/square_cur',
					type: "find",
				}, {
					text: $t('home.index.message'),
					icon: '/static/tabbar/find.png',
					icon_a: '/static/tabbar/find_cur',
					type: 'msg',
					
				}, {
					text: $t('home.index.my'),
					icon: '/static/tabbar/user.png',
					icon_a: '/static/tabbar/user_cur',
					type: "user",
				}, ],
				curType: "home",
				curStyle: "blue",
				isLogin:1,
				whtext: this.$API.getFailText(),
				FailWeb: this.$API.getFailWeb(),
				FailUrl: this.$API.getFailUrl(),
				tabCurTab:1,
				gonggaotime: 86400000,
				curPage: 0,
				qzgx: 1,
				isShow: false,
				announcement: "",
				isAnnouncement: false,
				versionCode: 0,
				wgtVer: '',
				msgNoticeSum: 0,
				Update: 0,
				versionUrl: "",
				versionTitle: "",
				versionIntro: "",
				scrollTop: 0,
				modOrder: 0,
				wzof: 0,
				isHuaWei: this.$API.isHuaWei(),
				isTy: false,
				tzof: 0,
				pyuser: 0,
				shopof: 0,
				startImg: {
					localUrl: ""
				},
				isStart: false,
				iosOf: 0,
				unreadNumLoading: null,
				backButtonPress: 0,
				isvip:0,
				pageShow:false,
				sy_appbox:false,
				appModOrder:0,
			};
		},
		onHide() {
			var that = this;
			that.pageShow = false;
		},
		onUnload() {
			var that = this;
			that.pageShow = false;
			
			// 移除事件监听器
			uni.$off('refreshIndexFindPage');
		},
		onPageScroll(res){
			var that = this;
			that.scrollTop = res.scrollTop;
		},
		onBackPress() {
			var that = this;
			// #ifdef APP-PLUS
			that.backButtonPress++;
			if (that.backButtonPress > 1) {
				plus.runtime.quit();
			} else {
				plus.nativeUI.toast(that.$t('home.index.exitapplication'));
			}
			setTimeout(() => {
				that.backButtonPress = 0;
			}, 1000);
			// #endif
			return true;
		},
		onPullDownRefresh() {
			var that = this;
			uni.$emit('onPullDownRefresh', that.curPage);
			var timer = setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		onShow() {
			var that = this;
			setTimeout(function() {
				uni.$emit('onShow', that.curPage);
			}, 200);
			// #ifdef APP-PLUS
			//外部启动APP处理
			var args = plus.runtime.arguments;
			plus.runtime.arguments = null;
			plus.runtime.arguments = "";
			if (args) {
				//跳转到文章
				if (args.indexOf("?info=") != -1) {
					var arr = args.split("?info=");
					uni.navigateTo({
						url: '/pages/contents/info?cid=' + arr[1]
					});
				}
				//判断是否是扫码登录
				if (args.indexOf("?scan=") != -1) {
					var arr = args.split("?scan=");
					that.scanLogin(arr[1]);
				}
			}
			// #endif
			if(that.pageShow){
				that.unreadNum();
			 }
			that.getUnreadNum();
		},
		//触底监听
		onReachBottom() {
			var that = this;
			uni.$emit('onReachBottom', that.curPage);
		},
		// #ifdef MP
		onShareAppMessage(res) {
			var that = this;
			if (res.from === 'button') {
				// 来自页面内分享按钮
			}
			if (res.from === 'menu') {
				// 来自页面内分享按钮
			}
			var title = that.$API.GetAppName();
			var data = {
				title: title,
			}
			return data;
		},
		onShareTimeline() {
			var that = this;
			var title = that.$API.GetAppName();
			var data = {
				title: title,
			}
			return data;
		},
		// #endif
		onLoad(res) {
			let that = this;
			// #ifdef APP-PLUS
			plus.screen.lockOrientation('portrait-primary');
			// #endif
			//会员不显示开屏广告
			if(localStorage.getItem('userinfo')){
				var userInfo = JSON.parse(localStorage.getItem('userinfo'));
				that.isvip = userInfo.isvip;
				if(that.isvip==1){
					that.isStart=true;
				}
			}
			let platform = uni.getSystemInfoSync().platform;
			
			localStorage.setItem('app_platform', platform);
			// #ifdef APP-PLUS || H5
			uni.getSystemInfo({
				success: function(res) {
					let model = ['X', 'XR', 'XS', '11', '12', '13', '14', '15', '16', 'iPhone'];
					model.forEach(item => {
						if (res.model.indexOf(item) != -1 && res.model.indexOf('iPhone') != -1) {
							that.paddingBottomHeight = 40;
						}
					})
				}
			});
			// #endif
			var cachedPlugins = localStorage.getItem('getPlugins');
			if (cachedPlugins) {
				const pluginList = JSON.parse(cachedPlugins);
				// 检查插件是否存在于插件列表中 
				// #ifdef APP-PLUS || H5
				that.sy_appbox = pluginList.includes('sy_appbox');
				// #endif
			}
			if(that.sy_appbox){
				that.getAppBoxInfo();
			}
			that.getAnnouncement();
			// #ifdef APP-PLUS
			that.isUpdate(false);
			// #endif
			setTimeout(function() {
				that.isStart = true;
			}, 5000);
			// #ifdef APP-PLUS
			that.appStartImg();
			//#endif
			that.unreadNum();
			that.getUnreadNum();
			// setTimeout(function() {
			// 	uni.$emit('onShow', 0);
			// }, 200); 
			
			uni.$on('goUser', function(data) {
				that.tabbarChange("user", 3)
			});
			uni.$on('goMsg', function(data) {
				that.tabbarChange("msg", 2)
			});
			uni.$on('goFind', function(data) {
				that.tabbarChange("find", 1)
			});
			
			// 监听刷新find页面事件
			uni.$on('refreshIndexFindPage', function() {
				// 通过事件总线传递给find组件
				uni.$emit('refreshFindPage');
			});
			//确认当前风格
			localStorage.setItem('curFullStyle', "index");
		},
		
		onReady() {
			setTimeout(function() {
				uni.$emit('onShow', 0);
			}, 200);
		},
		mounted() {
			this.getgg();
			// #ifdef APP-PLUS || H5
			this.initStatusBarStyle();
			// #endif
		},
		methods: {
			getAppBoxInfo() {
				var that = this;
				uni.request({
					url: that.$API.PluginLoad('sy_appbox'),
					data: {
						"action": "getConfig",
					},
					method: 'GET',
					dataType: "json",
					success(res) {
						if (res.data.code == 200) {
							that.appModOrder = res.data.data.appModOrder;
						} else {
							
						}
					},
					fail(error) {
						uni.showToast({
							title: that.$t('common.networkfail'),
							icon: 'none'
						})
					}
				})
			},
			// #ifdef APP-PLUS || H5
			initStatusBarStyle() {
				if (uni.getSystemInfoSync().platform === 'android') {
					this.iosOf = 0; // Android 平台
				} else {
					this.iosOf = 1; // iOS 平台
				}
			},
			// #endif
			getShow() {
				var that = this;
				that.isPost = !that.isPost;
			},
			tabbarChange(type, index) {
				var that = this;
				that.isPost = false;
				that.curPage = index;
				that.curType = type;
				that.unreadNum();
				that.getUnreadNum();
				setTimeout(function() {
					uni.$emit('onShow', index);
				}, 200);
			},
			closeUpdate() {
				var that = this;
				that.Update = 0;
				// uni.showTabBar({
				// 	animation: true
				// });
			},
			// #ifdef APP-PLUS
			//权限检测
			showTC(){
				var that = this;
				var tc1 = false;
				let _permissionID = 'android.permission.WRITE_EXTERNAL_STORAGE';
				let _permissionID2 = 'android.permission.CAMERA';
				plus.android.checkPermission(_permissionID2,
					granted => {
						if (granted.checkResult == -1) {
							uni.showModal({
								title: that.$t('global.permissionapply'),
								content: that.$t('global.permissionapplydesc'),
								cancelText: that.$t('common.cancel'),
								confirmText: that.$t('global.agree'),
								showCancel: true,
								confirmColor: '#000',
								cancelColor: '#666',
								success: (res) => {
									if (res.confirm) {
										tc1 = true;
										that.requestPermissions();
									}else{
										that.isTy = false
										tc1 = true;
									}
								}
							})
							//还未授权当前查询的权限，打开权限申请目的自定义弹框
							that.$nextTick(() => {
								setTimeout(() => {
									that.ani = 'uni-' + that.type
								},30)
							})
						}
					},
					error => {
						
					}
				);
				plus.android.checkPermission(_permissionID,
					granted => {
						if (granted.checkResult == -1) {
							if(!tc1){
								uni.showModal({
									title: that.$t('global.permissionapply'),
									content: that.$t('global.permissionapplydesc'),
									cancelText: that.$t('common.cancel'),
									confirmText: that.$t('global.agree'),
									showCancel: true,
									confirmColor: '#000',
									cancelColor: '#666',
									success: (res) => {
										if (res.confirm) {
											return that.requestPermissions();
										}else{
											that.isTy = false
										}
									}
								})
							}
							
							//还未授权当前查询的权限，打开权限申请目的自定义弹框
							that.$nextTick(() => {
								setTimeout(() => {
									that.ani = 'uni-' + that.type
								},30)
							})
						}
					},
					error => {
						
					}
				);
				
			},
			requestPermissions() {
				let _this = this;
			
				let _permissionID = 'android.permission.WRITE_EXTERNAL_STORAGE';
				let _permissionID2 = 'android.permission.CAMERA';
				
				plus.android.checkPermission(_permissionID2,
					granted => {
						if (granted.checkResult == -1) {
							//还未授权当前查询的权限，打开权限申请目的自定义弹框
							
							_this.$nextTick(() => {
								setTimeout(() => {
									_this.ani = 'uni-' + _this.type
								},30)
							})
						}
					},
					error => {
						
					}
				);
				plus.android.requestPermissions([_permissionID2],
					(e) => {
						//关闭权限申请目的自定义弹框
						_this.ani = '';
						_this.$nextTick(() => {
							
						})
						if (e.granted.length > 0) {
							//当前查询权限已授权
							plus.android.checkPermission(_permissionID,
								granted => {
									if (granted.checkResult == -1) {
										//还未授权当前查询的权限，打开权限申请目的自定义弹框
										_this.$nextTick(() => {
											setTimeout(() => {
												_this.ani = 'uni-' + _this.type
											},30)
										})
									}
								},
								error => {
									
								}
							);
							plus.android.requestPermissions([_permissionID],
								(e) => {
									//关闭权限申请目的自定义弹框
									_this.ani = '';
									_this.$nextTick(() => {
										
									})
									if (e.granted.length > 0) {
										//当前查询权限已授权
										_this.isTy = true
									}
									if (e.deniedAlways.length > 0) {
										//当前查询权限已被永久禁用，此时需要引导用户跳转手机系统设置去开启
										uni.showModal({
											title: _this.$t('global.fogettips'),
											content: _this.$t('global.noalbumpermiss'),
											cancelText: _this.$t('common.cancel'),
											confirmText: _this.$t('global.setitup'),
											showCancel: true,
											confirmColor: '#000',
											cancelColor: '#666',
											success: (res) => {
												if (res.confirm) {
													_this.goSetting();
												}else{
													_this.isTy = false
												}
											}
										})
									}
								})
						}
						if (e.deniedAlways.length > 0) {
							//当前查询权限已被永久禁用，此时需要引导用户跳转手机系统设置去开启
							uni.showModal({
								title: _this.$t('global.fogettips'),
								content: _this.$t('global.nocamerapermiss'),
								cancelText: _this.$t('common.cancel'),
								confirmText: _this.$t('global.setitup'),
								showCancel: true,
								confirmColor: '#000',
								cancelColor: '#666',
								success: (res) => {
									if (res.confirm) {
										_this.goSetting();
									}else{
										_this.isTy = false
									}
								}
							})
						}
					})
			},
			//跳转手机系统设置
			goSetting() {
				var Intent = plus.android.importClass("android.content.Intent");
				var Settings = plus.android.importClass("android.provider.Settings");
				var Uri = plus.android.importClass("android.net.Uri");
				var mainActivity = plus.android.runtimeMainActivity();
				var intent = new Intent();
				intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
				var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
				intent.setData(uri);
				mainActivity.startActivity(intent);
			},
			// #endif
			toLink(text) {
				var that = this;
				// 关闭弹窗
				that.isPost = false;
				if (!localStorage.getItem('token') || localStorage.getItem('token') == "") {
					uni.showToast({
						title: that.$t('common.plslogin'),
						icon: 'none'
					})
					return false;
				}
				if(that.isTy==false&&that.isHuaWei==1){
					that.showTC()
				}
				uni.navigateTo({
					url: text
				});
			},
			refresh() {
				uni.startPullDownRefresh({
					success: () => {
					},
				});
				setTimeout(() => {
					uni.stopPullDownRefresh({
						success: () => {
							
						},
					});
				}, 2000);
			},
			totop() {
				// 返回顶部操作
				// #ifdef APP-PLUS
				uni.pageScrollTo({
					scrollTop: 0,
					duration: 300
				});
				// #endif
				// #ifdef H5
				window.scrollTo({
					top: 0,
					behavior: 'smooth', // Optional: add smooth scrolling behavior
				});
				// #endif
			},
			getgg() {
				var that = this;
				uni.request({
					url: that.$API.SPgonggao(),
					method: 'GET',
					dataType: "json",
					success(res) {
						that.tabCurTab = res.data.swiperinfo;
						that.gonggaotime = res.data.ggtime;
						if(res.data.swiperinfo!=1){
							that.tabCurTab = 0
						}
						if(that.tabCurTab==0){
							setTimeout(() => {
								that.getgg();
							}, 2000);
						}
					},
					fail(error) {
						that.tabCurTab = 0
						if(that.tabCurTab==0){
							setTimeout(() => {
								that.getgg();
							}, 2000);
						}
					}
				})
				uni.request({
					url: that.$API.SPset(),
					method: 'GET',
					dataType: "json",
					success(res) {
						that.wzof = res.data.wzof;
						that.tzof = res.data.tzof;
						that.shopof = res.data.shopof;
						that.modOrder = res.data.modOrder;
					},
					fail(error) {
						
					}
				})
			
			},
			getAnnouncement() {
				var that = this;
				that.$Net.request({
					url: that.$API.GetUpdateUrl(),
					header: {
						'content-type': 'application/json'
					},
					method: 'get',
					success: function(res) {
						that.announcement = res.data.announcement;
						if (that.announcement != "" || res.data.announcement) {
							if (localStorage.getItem('isAnnouncement')) {
								var oldTime = Number(localStorage.getItem('isAnnouncement'));
								var curTime = new Date().getTime();
								var difference = curTime - oldTime;
								if (difference > that.gonggaotime) {
									that.isAnnouncement = true;
								}
							} else {
								that.isAnnouncement = true;
							}
						}
					},
					fail: function(res) {
			
					}
				})
			},
			isUpdate(Status) {
				var that = this;
				plus.runtime.getProperty(plus.runtime.appid, function(inf) {
					that.wgtVer = inf.version //获取当前版本号
					that.versionCode = inf.versionCode;
					var version = inf.versionCode;
					that.$Net.request({
						url: that.$API.GetUpdateUrl(),
						header: {
							'content-type': 'application/json'
						},
						method: 'get',
						success: function(res) {
							var versionCode = res.data.versionCode;
							that.versionUrl = res.data.versionUrl;
							that.versionTitle = res.data.version;
							that.versionIntro = res.data.versionIntro;
							that.qzgx = res.data.qzgx;
							if (Status) {
								// uni.showToast({
								// 	title:"检测完成",
								// 	icon:'none',
								// 	duration: 1000,
								// 	position:'bottom',
								// });
							}
							if (versionCode > version) {
								uni.hideTabBar({
									animation: true
								})
								that.Update = 1;
								if (Status) {
									if (res.data.versionUrl != "") {
										plus.runtime.openURL(res.data.versionUrl);
									}
								}
							}
						},
						fail: function(res) {
			
						}
					})
				})
			},
			gogw(){
				var that = this;
				// #ifdef APP-PLUS
				plus.runtime.openURL(that.FailWeb);
				// #endif
				// #ifdef H5
				window.open(that.FailWeb)
				// #endif
				// #ifdef MP-WEIXIN
				uni.showToast({
					title: that.$t('home.index.miniprogramjump'),
					icon: 'none'
				})
				// #endif
			},
			goqun(){
				var that = this;
				// #ifdef APP-PLUS
				plus.runtime.openURL(that.FailUrl);
				// #endif
				// #ifdef H5
				window.open(that.FailUrl)
				// #endif
				// #ifdef MP-WEIXIN
				uni.showToast({
					title: that.$t('home.index.miniprogramjump'),
					icon: 'none'
				})
				// #endif
			},
			//自定义启动图广告相关
			toStartUrl() {
				if (localStorage.getItem('appStart')) {
					var imgData = JSON.parse(localStorage.getItem('appStart'));
					//如果线上的图片与本地缓存图片相同，就不再进行下载
					if (imgData.url) {
						var url = imgData.url;
						var type = imgData.urltype;
						if (url.indexOf("http") != -1) {
							// #ifdef APP-PLUS
							if (type == 1) {
								plus.runtime.openURL(url);
							}
							if (type == 0) {
								plus.runtime.openWeb(url);
							}
							// #endif
							// #ifdef H5
							window.open(url)
							// #endif
						} else {
							uni.navigateTo({
								url: url
							});
						}
					} else {
						return false
					}
				} else {
					return false
				}
			},
			toStart() {
				var that = this;
				that.isStart = true;
			},
			appStartImg() {
				var that = this;
				// #ifdef APP-PLUS
				if (localStorage.getItem('appStart')) {
					var imgData = JSON.parse(localStorage.getItem('appStart'));
					if (!imgData.localUrl || imgData.localUrl == "") {
						localStorage.removeItem('appStart');
						that.isStart = true;
						return false;
					}
					var localUrl = imgData.localUrl;
					//在请求之前，先为了性能载入上次图片
					plus.io.resolveLocalFileSystemURL(imgData.localUrl, function(entry) {
						imgData.localUrl = localUrl;
						that.startImg = imgData;
						that.isStart = false;
					}, function(e) {
						localStorage.removeItem('appStart');
						that.isStart = true;
					});
				}
				if (localStorage.getItem('startAds')) {
					var data = JSON.parse(localStorage.getItem('startAds'));
					var adsNum = data.length;
					if (adsNum > 0) {

						var adsRand = Math.floor(Math.random() * adsNum);
						var appStartPic = data[adsRand].img;
						if (appStartPic != "") {
							appStartPic = appStartPic.replace(/[\r\n]/g, "");
							var imgData = data[adsRand];
							imgData.appStartPic = appStartPic;
							that.Download(imgData);
						}
					} else {
						localStorage.removeItem('appStart');
						that.isStart = true;
					}
				}
				// #endif
			},
			Download(startImg) {
				var that = this;
				// #ifdef APP-PLUS
				var url = startImg.appStartPic;
				if (localStorage.getItem('appStart')) {
					var imgData = JSON.parse(localStorage.getItem('appStart'));
					//如果线上的图片与本地缓存图片相同，就不再进行下载
					if (url == imgData.appStartPic) {
						//但是链接可能变化，所以需要载入缓存
						var oldStartImg = imgData;
						localStorage.setItem('appStart', JSON.stringify(oldStartImg));
						return false;
					}
				}
				uni.downloadFile({
					url: url, //下载地址接口返回
					success: (data) => {
						if (data.statusCode === 200) {
							//文件保存到本地
							uni.saveFile({
								tempFilePath: data.tempFilePath, //临时路径
								success: function(res) {
									// uni.showToast({
									// 	icon: 'none',
									// 	mask: true,
									// 	title: '文件已保存：' + res.savedFilePath, //保存路径
									// 	duration: 3000,
									// });
									startImg.localUrl = res.savedFilePath;
									localStorage.setItem('appStart', JSON.stringify(startImg));
									that.startImg = startImg;
								}
							});
						}
					},
					fail: (err) => {
						// uni.showToast({
						// 	icon: 'none',
						// 	mask: true,
						// 	title: '失败请重新下载',
						// });
					},
				});
				// #endif
			},
			readAnnouncement() {
				var that = this;
				that.isAnnouncement = false;
				var timestamp = new Date().getTime();
				localStorage.setItem('isAnnouncement', timestamp);

			},
			unreadNum() {
				var that = this;
				var token = ""
				if (localStorage.getItem('userinfo')) {
					var userInfo = JSON.parse(localStorage.getItem('userinfo'));
					token = userInfo.token;
				}
				that.$Net.request({
					url: that.$API.unreadNum(),
					data: {
						"token": token
					},
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					method: "get",
					dataType: 'json',
					success: function(res) {
						if (res.data.code == 1) {
							var noticeSum = res.data.data.total;
							localStorage.setItem('noticeSum', noticeSum);
						}
					},
					fail: function(res) {
						uni.showToast({
							title: that.$t('common.networkfail'),
							icon: 'none'
						})
					}
				})
			},
			getUnreadNum() {
				var that = this;
				if(localStorage.getItem('noticeSum')){
					that.msgNoticeSum = Number(localStorage.getItem('noticeSum'));
				}
			},
			// 获取底部导航栏图标路径
			getTabIcon(item, isActive) {
				var that = this;
				var basePath = '';
				if (isActive) {
					// 选中状态的图标
					basePath = item.icon_a;
				} else {
					// 未选中状态的图标
					basePath = item.icon.replace('.png', '');
				}
				// 如果是夜间模式，添加 _d 后缀
				if (that.isDark) {
					return basePath + '_d.png';
				} else {
					return basePath + '.png';
				}
			},
		}
	};
</script>
<style lang="scss" scoped>
	.open-vip {
		width: 100%;
		height: 72rpx;
		background: linear-gradient(180deg, #F7E5B4 0%, #FFE6AF 2%, #EBC075 100%);
		border-radius: 49rpx;
		display: flex;
		align-items: center;
		margin-top: 36rpx;
		padding: 0 24rpx 0 34rpx;
		box-sizing: border-box;
	
		>image {
			width: 48rpx;
			height: 48rpx;
		}
	
		.text {
			flex: 1;
			font-size: 24rpx;
			line-height: 34rpx;
			margin-left: 14rpx;
		}
	
		.button {
			width: 128rpx;
			height: 42rpx;
			background: linear-gradient(90deg, #4D4D4D 0%, #151515 100%);
			border-radius: 22rpx;
			font-size: 22rpx;
			color: #FFDFA9;
			line-height: 42rpx;
			text-align: center;
		}
	}
	.mine {
		max-height: 100vh;
	}

	/* 底部安全边距 start*/
	.tn-tabbar-height {
		min-height: 120rpx;
		height: calc(140rpx + env(safe-area-inset-bottom) / 2);
		height: calc(140rpx + constant(safe-area-inset-bottom));
	}

	.tn-color-cat {
		color: #1D2541;
	}

	.tn-bg-cat {
		background-color: #1D2541;
	}


	/* 自定义导航栏内容 start */
	.custom-nav {
		height: 100%;

		&__back {
			margin: auto 5rpx;
			font-size: 40rpx;
			margin-right: 10rpx;
			flex-basis: 5%;
			width: 100rpx;
			position: absolute;
		}
	}

	/* 自定义导航栏内容 end */


	/* 顶部背景图 end */


	/* 用户头像 start */
	.logo-image {
		width: 110rpx;
		height: 110rpx;
		position: relative;
		overflow: hidden;
		border-radius: 50%;
	}

	.logo-pic {
		background-size: cover;
		background-repeat: no-repeat;
		// background-attachment:fixed;
		background-position: top;
		box-shadow: 0rpx 0rpx 60rpx 0rpx rgba(0, 0, 0, 0.1);
		border-radius: 50%;
		overflow: hidden;
		// background-color: #FFFFFF;
	}

	/* 页面 start*/
	.about-shadow {
		border-radius: 30rpx;
		box-shadow: 0rpx 0rpx 50rpx 0rpx rgba(0, 0, 0, 0.07);
	}

	.about {

		&__wrap {
			position: relative;
			z-index: 1;
			margin: 20rpx 30rpx;
		}
	}

	/* 页面 end*/

	/* 图标容器15 start */
	.icon15 {
		&__item {
			width: 30%;
			background-color: #FFFFFF;
			border-radius: 10rpx;
			padding: 30rpx;
			margin: 20rpx 10rpx;
			transform: scale(1);
			transition: transform 0.3s linear;
			transform-origin: center center;

			&--icon {
				width: 100rpx;
				height: 100rpx;
				font-size: 60rpx;
				border-radius: 50%;
				margin-bottom: 18rpx;
				position: relative;
				z-index: 1;

				&::after {
					content: " ";
					position: absolute;
					z-index: -1;
					width: 100%;
					height: 100%;
					left: 0;
					bottom: 0;
					border-radius: inherit;
					opacity: 1;
					transform: scale(1, 1);
					background-size: 100% 100%;


				}
			}
		}
	}

	/* 图标容器12 start */
	.tn-three {
		position: absolute;
		top: 50%;
		right: 50%;
		bottom: 50%;
		left: 50%;
		transform: translate(-38rpx, -16rpx) rotateX(30deg) rotateY(20deg) rotateZ(-30deg);
		text-shadow: -1rpx 2rpx 0 #f0f0f0, -2rpx 4rpx 0 #f0f0f0, -10rpx 20rpx 30rpx rgba(0, 0, 0, 0.2);
	}

	.icon20 {
		&__item {
			width: 30%;
			background-color: #FFFFFF;
			border-radius: 10rpx;
			padding: 30rpx;
			margin: 20rpx 10rpx;
			transform: scale(1);
			transition: transform 0.3s linear;
			transform-origin: center center;

			&--icon {
				width: 100rpx;
				height: 100rpx;
				font-size: 60rpx;
				border-radius: 50%;
				margin-bottom: 18rpx;
				position: relative;
				z-index: 1;

				&::after {
					content: " ";
					position: absolute;
					z-index: -1;
					width: 100%;
					height: 100%;
					left: 0;
					bottom: 0;
					border-radius: inherit;
					opacity: 1;
					transform: scale(1, 1);
					background-size: 100% 100%;
					background-image: url();
				}
			}
		}
	}



	.button-vip {
		width: 100%;
		height: 150rpx;
		border-radius: 15rpx;
		position: relative;
		z-index: 1;

		&::after {
			content: " ";
			position: absolute;
			z-index: -1;
			width: 100%;
			height: 100%;
			left: 0;
			bottom: 0;
			border-radius: inherit;
			opacity: 1;
			transform: scale(1, 1);
			background-size: 100% 100%;
			background-image: url(https://tnuiimage.tnkjapp.com/cool_bg_image/icon_bg.png);
		}
	}


	/* 图标容器12 start */
	.icon12 {
		&__item {
			width: 30%;
			background-color: #FFFFFF;
			border-radius: 10rpx;
			padding: 30rpx;
			margin: 20rpx 10rpx;
			transform: scale(1);
			transition: transform 0.3s linear;
			transform-origin: center center;

			&--icon {
				width: 15rpx;
				height: 15rpx;
				font-size: 50rpx;
				border-radius: 50%;
				margin-bottom: 38rpx;
				position: relative;
				z-index: 1;

				&::after {
					content: " ";
					position: absolute;
					z-index: -1;
					width: 100%;
					height: 100%;
					left: 0;
					bottom: 0;
					border-radius: inherit;
					opacity: 1;
					transform: scale(1, 1);
					background-size: 100% 100%;

				}
			}
		}
	}

	/* 图标容器1 start */
	.icon1 {
		&__item {
			// width: 30%;
			background-color: #FFFFFF;
			border-radius: 10rpx;
			padding: 30rpx;
			margin: 20rpx 10rpx;
			transform: scale(1);
			transition: transform 0.3s linear;
			transform-origin: center center;

			&--icon {
				width: 40rpx;
				height: 40rpx;
				font-size: 40rpx;
				border-radius: 50%;
				position: relative;
				z-index: 1;

				&::after {
					content: " ";
					position: absolute;
					z-index: -1;
					width: 100%;
					height: 100%;
					left: 0;
					bottom: 0;
					border-radius: inherit;
					opacity: 1;
					transform: scale(1, 1);
					background-size: 100% 100%;
					background-image: url();
				}
			}
		}
	}

	/* 图标容器1 end */


	/* 顶部背景图 start */
	.top-backgroup {
		height: 450rpx;
		z-index: -1;

		.backgroud-image {
			width: 100%;
			height: 450rpx;
			// z-index: -1;
		}
	}

	/* 顶部背景图 end */
	.text-1 {
		overflow: hidden;
		display: -webkit-box;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;
	}
	.name-vip {
		color: #ff6c3e;
	}
.user-rz{
	position: relative;
	display: inline-block;
}
.user-rz-icon{
	position: absolute;
	left: 28upx;
	bottom: 20upx;
	padding: 0upx 6upx;
	line-height: 30upx;
}
.user-rz-icon-xcx{
	position: absolute;
	left: 30upx;
	bottom: 17upx;
	padding: 0upx 6upx;
	line-height: 32upx;
}
.border-white{
	border: 2upx solid #fff;
}


		.forum-post-btn-1 {
			position: fixed;
			z-index: 888;
			bottom: 200upx;
			right: 60upx;
			width: 90upx;
			height: 90upx;
			font-size: 40upx;
			color: #fff;
			border-radius: 50%;
			text-align: center;
			line-height: 90upx;
		}
		
		.forum-post-btn-2 {
			position: fixed;
			z-index: 888;
			bottom: 300upx;
			right: 60upx;
			width: 90upx;
			height: 90upx;
			font-size: 40upx;
			color: #fff;
			border-radius: 50%;
			text-align: center;
			line-height: 90upx;
		}
		.box-shadow-1 {
			box-shadow: 0 0 10upx #31C9E8bf;
		}
		.box-shadow-2 {
			box-shadow: 0 0 10upx #Ff9700bf;
		}

		/* 全屏发布弹窗样式 */
		.publish-modal {
			position: fixed;
			top: 0;
			left: 0;
			width: 100vw;
			height: 100vh;
			z-index: 9999;
			opacity: 0;
			visibility: hidden;
			background: rgba(255, 255, 255, 0.85);
			backdrop-filter: blur(40upx);
			-webkit-backdrop-filter: blur(40upx);
			transition: all 0.3s ease-in-out;
		}

		.publish-modal.show {
			opacity: 1;
			visibility: visible;
		}

		.publish-modal-content {
			position: relative;
			width: 100%;
			height: 100%;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: flex-start;
			padding: 100upx 80upx;
			box-sizing: border-box;
			transform: scale(0.8) translateY(100upx);
			transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
		}

		.publish-modal-content.show {
			transform: scale(1) translateY(0);
		}

		/* 顶部文案区域 */
		.publish-header {
			text-align: left;
			margin-bottom: 120upx;
			width: 100%;
		}

		.publish-title {
			font-size: 64upx;
			font-weight: 300;
			color: #333333;
			margin-bottom: 24upx;
			letter-spacing: 4upx;
		}

		.publish-subtitle {
			font-size: 32upx;
			color: #666666;
			letter-spacing: 2upx;
			font-weight: 300;
		}

		/* 发布选项区域 */
		.publish-options {
			flex: 1;
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.publish-grid {
			display: grid;
			grid-template-columns: repeat(3, 1fr);
			gap: 20upx;
			width: 100%;
			max-width: 800upx;
		}

		.publish-item {
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			cursor: pointer;
			transition: all 0.3s ease;
		}

		.publish-item:active {
			transform: scale(0.95);
		}

		.publish-icon-container {
			width: 100upx;
			height: 100upx;
			border-radius: 30upx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 50upx;
			color: #333333;
			margin-bottom: 20upx;
			background: rgba(255, 255, 255, 0.9);
			backdrop-filter: blur(10upx);
			box-shadow: 0 8upx 30upx rgba(0, 0, 0, 0.1);
			transition: all 0.3s ease;
		}

		.publish-item:hover .publish-icon-container {
			transform: translateY(-6upx);
			background: rgba(255, 255, 255, 1);
			box-shadow: 0 12upx 40upx rgba(0, 0, 0, 0.15);
		}

		.publish-item:active .publish-icon-container {
			background: rgba(240, 240, 240, 0.9);
		}

		.publish-text {
			font-size: 28upx;
			color: #333333;
			text-align: center;
			font-weight: 300;
		}

		/* 关闭按钮 - 居中底部 */
		.publish-close-center {
			position: absolute;
			bottom: 10upx;
			left: 50%;
			transform: translateX(-50%);
			width: 100upx;
			height: 100upx;
			border-radius: 50%;
			background: rgba(255, 255, 255, 0.9);
			backdrop-filter: blur(10upx);
			display: flex;
			align-items: center;
			justify-content: center;
			cursor: pointer;
			transition: all 0.3s ease;
			box-shadow: 0 8upx 30upx rgba(0, 0, 0, 0.1);
		}

		.publish-close-center:hover {
			background: rgba(255, 255, 255, 1);
			transform: translateX(-50%) scale(1.05);
			box-shadow: 0 12upx 40upx rgba(0, 0, 0, 0.15);
		}

		.publish-close-center:active {
			background: rgba(240, 240, 240, 0.9);
			transform: translateX(-50%) scale(0.95);
		}

		.close-icon-center {
			font-size: 50upx;
			color: #333333;
			font-weight: 300;
			line-height: 1;
		}

		/* 深色模式适配 */
		.dark .publish-modal {
			background: rgba(40, 40, 40, 0.85);
		}

		.dark .publish-title {
			color: #ffffff;
		}

		.dark .publish-subtitle {
			color: #cccccc;
		}

		.dark .publish-text {
			color: #ffffff;
		}

		.dark .publish-icon-container {
			background: rgba(40, 40, 40, 0.9);
			color: #ffffff;
		}

		.dark .publish-item:hover .publish-icon-container {
			background: rgba(40, 40, 40, 0.9);
			color: #ffffff;
		}

		.dark .publish-item:active .publish-icon-container {
			background: rgba(30, 30, 30, 0.9);
		}

		.dark .publish-close-center {
			background: rgba(40, 40, 40, 0.9);
		}

		.dark .publish-close-center:hover {
			background: rgba(60, 60, 60, 1);
		}

		.dark .publish-close-center:active {
			background: rgba(30, 30, 30, 0.9);
		}

		.dark .close-icon-center {
			color: #ffffff;
		}

		/* 响应式适配 */
		@media (max-width: 1000upx) {
			.publish-grid {
				grid-template-columns: repeat(3, 1fr);
				gap: 20upx;
			}
			
			.publish-icon-container {
				width: 100upx;
				height: 100upx;
				font-size: 70upx;
			}

			.publish-close-center {
				bottom: 40upx;
				width: 110upx;
				height: 110upx;
			}

			.close-icon-center {
				font-size: 60upx;
			}
		}
  
</style>
